<?php

namespace app\business\controller;

use app\business\model\BusinessTable;
use think\Db;
use think\Session;
use think\Controller;
use think\Cookie;


class Code extends Controller
{
    public function encrypts($id,$code)
    {
        $info = BusinessTable::where('id',$id)->find();

        if($info['table_status']==2){
            return '有人';
        }
        if($code==md5($info['table_name'])){
            BusinessTable::where('id',$id)->update(['table_status'=>2]);

            $data['a'] = '订座成功';
            //餐桌id
            $data['b'] = $info['id'];
            //商家id
            $data['c'] = $info['business_id'];
            return json_encode($data);
        }else{
            return '失败';
        }
    }

    public function chanceId($id)
    {
        return $id;
    }
}

